#include <iostream>
#include <algorithm>
using namespace std;
const int N=1000;
int arr6[N+1]={0};

int main_25()
{
    int n,cur,diff=10000;
    cin>>n;
    for (int i=0;i<n ;i++ )
    {
        cin>>arr6[i];
    }
    sort(arr6,arr6+n);
    for (int i=1;i<n ;i++ )
    {
        cur=arr6[i]-arr6[i-1];
        diff=cur<diff?cur:diff;
    }
    cout << diff << endl;
	return 0;
}
